<?php

class SiteInterceptor  extends C_Interceptor
{
	public function _begin()
	{
		//获取当前站点
		if(Zend_Registry::isRegistered('RootOper',$RootOper) 
			&& Zend_Registry::isRegistered('site_E'))
			{
				$this->_response->RootOper = Zend_Registry::get('RootOper');
				$this->_response->site_E = Zend_Registry::get('site_E');
				return ;
			}
	
		
		
		$siteid = $this->_request->get("siteid");
		$error_info = "站点不存在";
		if(empty($siteid))
		{
			$jumpurl = $this->_response->getUrl('index', 'error','error',array('error_info'=>$error_info));
			$this->_response->RedirectJump($jumpurl);
		}
		$site_E = Sites::getById($siteid);
		if(empty($site_E))
		{
			$jumpurl = $this->_response->getUrl('index', 'error','error',array('error_info'=>$error_info));
			$this->_response->RedirectJump($jumpurl);
		}
			
		//认证站点****end*************************************************
		$this->_response->site_E = $site_E;
		Zend_Registry::set('site_E',$site_E);
		$user_E = Zend_Registry::get('user_E');
		//认证操作权限
		$RootOper = 0;
		if(!empty($user_E))
		{
			if($site_E->userid == $user_E->id)
			{
				$RootOper = 1;			
			}
		}
		$this->_response->RootOper = $RootOper;
		Zend_Registry::set('RootOper',$RootOper);
	}
	public function _end()
	{
		
		
	}
}
?>